<!--换房申请-->
<template>
	<div class="wrap">
		<el-tabs style="height: 100%" v-model="activeName" @tab-change="handleChangeEvent">
			<HandleChangeRoomApply />
			<ChangeRoomApplyLog :changeRoomInfo="changeRoomInfo" :total="total" @search="handleSearchResult"/>
		</el-tabs>
	</div>
</template>

<script setup>
import HandleChangeRoomApply from '@/components/mod/HandleChangeRoomApply.vue'
import ChangeRoomApplyLog from '@/components/mod/ChangeRoomApplyLog.vue'
import { ref } from 'vue'

import { queryExchangeInfoAll } from '@/utils/axios/domiRequests';
import { getExchangeInfoBuild } from '@/utils/axios/getTotal';

const activeName = ref('changeRoomApply')

const changeRoomInfo=ref()
const total=ref(0)

const handleChangeEvent = async(name) => {
	if(name=='changeRoomHistory'){
		await init()
	}
}

// 处理搜索结果
const handleSearchResult=({data,tota})=>{
	changeRoomInfo.value=data
	total.value=tota ?? 0
}

async function init() {
	let { data } = await queryExchangeInfoAll({
		currentPage: 1,
		pageSize: 10,
	})
	let res = await getExchangeInfoBuild()
	changeRoomInfo.value = data
	total.value = res.data
}

</script>

<style scoped lang="scss">
.el-tabs {
	height: 500px;
	&:deep(.el-tabs__content) {
		height: 500px;

	}
}

.btn {
	background: rgb(0, 202, 237);
	color: #ffff;
}
</style>
